<?php
/**
 * @file
 * Returns the HTML for a single Drupal page.
 *
 * Complete documentation for this file is available online.
 * @see https://drupal.org/node/1728148
 */
global $theme_path;
$node = menu_get_object();
$fes = array();
if (!empty($node->field_article_content[LANGUAGE_NONE])) {
  foreach ($node->field_article_content[LANGUAGE_NONE] as $k => $v) {
    $fes[] = field_collection_item_load($v['value']);
  }
}
?>
<?php print $messages; ?>

<div id="page">
    <header id="header">
		<?php print render( $page['header']['metatags']); ?>
        <div class="section-wrapper">
            <a id="sidemenu-toggle"></a>
            <div id="sidemenu">
                <?php echo bck_render_('jessica-channel-side-menu'); ?>
            </div>
            <a id="logo" href="/jtv"><img src="/<?php echo path_to_theme(); ?>/images/logo-jtv.svg" alt="JTV"></a>
            <div id="mainmenu">
                <?php echo bck_render_('jessica-channel-menu'); ?>
            </div>
            <div id="header-search">
                <a id="header-search-toggle"></a>
                <?php echo bck_render('views', '-exp-search_page-page'); ?>
            </div>
            </div>
    </header>

    <div id="main">
        <div class="block-dfp">
          <?php print bck_render_('ads-blog-1080x120'); ?>
        </div>
        <div id="content" class="column region-content" role="main">
            <article class="app" data-nid="<?php echo $node->nid; ?>">
                <div class="section-left">
                    <div class="wrapper">
        <?php $b = drupal_get_breadcrumb();
        echo '<h2 class="element-invisible">You are here</h2><div class="breadcrumb">' . $b[0] .
(empty($b[1]) ? '' : '&nbsp;&nbsp;>&nbsp;&nbsp;' . $b[1]) .
(empty($b[2]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[2]) .
(empty($b[3]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[3]) .
(empty($b[4]) ? '' : '&nbsp;&nbsp;>>&nbsp;&nbsp;' . $b[4]) .
'</div>'; ?>
                        <?php print render( $title_prefix ); ?>
                        <?php print render( $title_suffix ); ?>
                        <?php print render( $tabs ); ?>
                        <?php if ( $action_links ): ?>
                            <ul class="action-links"><?php print render( $action_links ); ?></ul>
                        <?php endif; ?>

                        <h2 class="node-title"><?php print $title; ?></h2>
                        <div class="article-top">
                            <!--
                            <?php echo jessica_thm_author_author_section( $node ); ?>
                            -->
                            <div class="article-share">
                            <!--
                                <div class="article-share-amount">
                                    <?php if ( ! empty( $node->field_social_count ) ): ?>
                                        <strong><?php print $node->field_social_count['und'][0]['value']; ?></strong>
                                    <?php else: ?>
                                        <strong>0</strong>
                                    <?php endif; ?>SHARES
                                </div>
                            -->
                                <div class="article-share-action">
                                    <button class="article-share-toggle">SHARE</button>
                                    <a href="#" class="article-share-icon icon-facebook" target="_blank"></a>
                                    <a href="#" class="article-share-icon icon-email"></a>
                                    <a href="#" class="article-share-icon icon-sina" target="_blank"></a>
                                    <a href="#" class="article-share-icon icon-close article-share-close"></a>
                                    <!-- <a href="#" class="article-share-open icon icon-share"></a> -->
                                    <!-- <a href="#" class="article-share-icon icon icon-pinterest" target="_blank"></a> -->
                                    <!-- <a href="#" class="article-share-close icon icon-cross"></a> -->
                                </div>
                            </div>
                        </div>

                        <?php foreach ($fes as $fe): ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_image', array('label' => 'hidden', 'type' => 'img_with_caption'))); ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_body', array('label' => 'hidden'))); ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_video', array('label' => 'hidden'))); ?>
                          <?php echo render_(field_view_field('field_collection_item', $fe, 'field_images', array('label' => 'hidden'))); ?>
                        <?php endforeach; ?>
                        <?php echo render_(field_view_field('node', $node, 'field_tags', array('label' => 'hidden'))); ?>

                        <div class="extend-read">
                            <h4>延伸閱讀 +</h4>
                            <?php echo render_(field_view_field('node', $node, 'field_jtv_links', array('label' => 'hidden'))); ?>
                        </div>

                        <div class="article-readmore">
                            <a href="#">+ 繼續閱讀</a>
                        </div>
                    </div>
                </div>

                <div class="section-right">
                    <div class="wrapper">
                        <div class="block-dfp">
                        <?php
                        print bck_render_('ads-article-300x600');
                        ?>
                        </div>
                        <?php
                        print bck_render_('jtv-related');
                        $sidebar_first = render( $page['sidebar_first'] );
                        if ( $sidebar_first ) {
                            print $sidebar_first;
                        }
                        ?>
                        <div class="block-dfp">
                        <?php
                        print bck_render_('ads-article-300x250');
                        ?>
                        </div>
                    </div>
                </div>
            </article>
            <div id="article-loading"></div>
        </div>
    </div>

    <div class="region region-bottom"></div>
	<?php print render( $page['footer']['ga-dimension']); ?>
    <footer id="footer" class="region region-footer"></footer>

</div>
